import ImageCommon from '../assets/common/ImageCommon'

interface TimerInfo {
  day: number,
  hour: string,
  minute: string,
  second: string
 }
export function getTimerInfo(time:number): TimerInfo{

  if (time && time > 0){
    const check=(num:Number):string=>{
      if (num < 10){
        return '0' + num
      }
      return num + ''
    }
    const day = Math.floor(time / 3600 / 24)
    const hour:string = check(Math.floor(time/3600%24))
    const minute:string = check(Math.floor(Math.floor(time%3600)/60))
    const second:string = check(time%60)
    return {
      day,
      hour,
      minute,
      second
    }
  }
  return {
    day: 0,
    hour: '',
    minute: '',
    second: ''
  }
}
export function getDayImg(day:number){
  switch(day){
    case 0:
      return ImageCommon.cd_0
    case 1:
      return ImageCommon.cd_1
    case 2:
      return ImageCommon.cd_2
    case 3:
      return ImageCommon.cd_3
    case 4:
      return ImageCommon.cd_4
    case 5:
      return ImageCommon.cd_5
    case 6:
      return ImageCommon.cd_6
    case 7:
      return ImageCommon.cd_7
    case 8:
      return ImageCommon.cd_8
    case 9:
      return ImageCommon.cd_9
    default:
      return ImageCommon.cd_0
  }
} 